{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from keras.datasets import imdb\n",
    "from keras.preprocessing import sequence\n",
    "from keras.models import Sequential\n",
    "from keras.layers import Dense,Embedding,LSTM\n",
    "from keras.layers import Flatten"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "max_features=20000\n",
    "text_max_words=200"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Downloading data from https://s3.amazonaws.com/text-datasets/imdb.npz\n",
      "17465344/17464789 [==============================] - 14s 1us/step\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\masaikk\\anaconda3\\envs\\mytf\\lib\\site-packages\\keras\\datasets\\imdb.py:101: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray\n",
      "  x_train, y_train = np.array(xs[:idx]), np.array(labels[:idx])\n",
      "C:\\Users\\masaikk\\anaconda3\\envs\\mytf\\lib\\site-packages\\keras\\datasets\\imdb.py:102: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray\n",
      "  x_test, y_test = np.array(xs[idx:]), np.array(labels[idx:])\n"
     ]
    }
   ],
   "source": [
    "(x_train,y_train),(x_test,y_test)=imdb.load_data(num_words=max_features)\n",
    "x_val=x_train[20000:]\n",
    "y_val=y_train[20000:]\n",
    "x_train=x_train[:20000]\n",
    "y_train=y_train[:20000]\n",
    "\n",
    "x_train=sequence.pad_sequences(x_train,maxlen=text_max_words)\n",
    "x_val=sequence.pad_sequences(x_val,maxlen=text_max_words)\n",
    "x_test=sequence.pad_sequences(x_test,maxlen=text_max_words)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "model=Sequential()\n",
    "model.add(Embedding(max_features,128))\n",
    "model.add(LSTM(128))\n",
    "model.add(Dense(1,activation='sigmoid'))\n",
    "\n",
    "model.compile(loss='binary_crossentropy',optimizer='adam',metrics=['accuracy'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\masaikk\\anaconda3\\envs\\mytf\\lib\\site-packages\\tensorflow_core\\python\\framework\\indexed_slices.py:433: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.\n",
      "  \"Converting sparse IndexedSlices to a dense Tensor of unknown shape. \"\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train on 20000 samples, validate on 5000 samples\n",
      "Epoch 1/2\n",
      "20000/20000 [==============================] - 83s 4ms/step - loss: 0.4120 - accuracy: 0.8129 - val_loss: 0.3333 - val_accuracy: 0.8538\n",
      "Epoch 2/2\n",
      "20000/20000 [==============================] - 150s 8ms/step - loss: 0.2190 - accuracy: 0.9172 - val_loss: 0.3620 - val_accuracy: 0.8718\n"
     ]
    }
   ],
   "source": [
    "hist=model.fit(x_train,y_train,epochs=2,batch_size=64,validation_data=(x_val,y_val))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbcAAAEKCAYAAACRwxtAAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm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AHc/ApDf3tPu3pmffgY4GfhVxfdKJEYUbiKjZ8C33f3GY2aa/c9B5UYa226kU419Be+z6P+pyKjptKTI6P0UeJeZHQ9gZtPM7CSC/0/vype5FviVux8E9pvZ+fn57wMezz9LrNPMrsxvoyk/Sr+IlIG+EYqMkrtvMrPPAP9qZgmgH/go0AOcbma/AQ4SXJcDWAHcnQ+vl3htlPb3AV83s8/nt/GnVdwNkVjTUwFEysTMut19UtT1EBGdlhQRkRjSkZuIiMSOjtxERCR2FG4iIhI7CjcREYkdhZuIiMSOwk1ERGLn/wNhZVPdo2M5LQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig,loss_ax=plt.subplots()\n",
    "acc_ax=loss_ax.twinx()\n",
    "\n",
    "loss_ax.plot(hist.history['loss'],'y',label='train_loss')\n",
    "loss_ax.plot(hist.history['val_loss'],'r',label='val_loss')\n",
    "loss_ax.set_ylim([-0.2,1.2])\n",
    "acc_ax.plot(hist.history['accuracy'],'b',label='train_acc')\n",
    "acc_ax.plot(hist.history['val_accuracy'],'g',label='val_acc')\n",
    "acc_ax.set_ylim([-0.2,1.2])\n",
    "\n",
    "loss_ax.set_xlabel('epoch')\n",
    "loss_ax.set_ylabel('loss')\n",
    "acc_ax.set_ylabel('accuracy')\n",
    "\n",
    "loss_ax.legend()\n",
    "acc_ax.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "25000/25000 [==============================] - 19s 740us/step\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[0.4004193203639984, 0.8590800166130066]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.evaluate(x_test,y_test,batch_size=64)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
